package numerics;


public class Sums {
	public static double arraySum(double [] values) {
		double soma = 0;
		for(double i: values) {
			soma += i;
		}
		return soma;
	}
	
	public static double squaredSum(double [] values) {
		double soma = 0;
		for(double i: values) {
			soma += i * i;
		}
		return soma;
	}
	
	public static double pairSum(Pair [] pairs) {
		double soma = 0;
		for(Pair p: pairs) {
			soma += p.getX() * p.getY();
		}
		return soma;
	}
}
